/******************************************************************************
 * Epigraph compiler                                                          *
 * Copyright © 2011 Grigorev Svyatoslav                                       *
 *                                                                            *
 * This program is free software: you can redistribute it and/or modify       *
 *     it under the terms of the GNU General Public License as published by   *
 *     the Free Software Foundation, either version 3 of the License, or      *
 *     (at your option) any later version.                                    *
 *                                                                            *
 *     This program is distributed in the hope that it will be useful,        *
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *     GNU General Public License for more details.                           *
 *                                                                            *
 *     You should have received a copy of the GNU General Public License      *
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
 ******************************************************************************/

// Обработка ошибок

package epg;

import java.io.*;

class Error {

	static void Message(String Msg) {
		int ELine = Location.Line;
		while (Text.Ch != Text.chEOL && Text.Ch != Text.chEOT)
			Text.NextCh();
		if (Text.Ch == Text.chEOT) System.out.println();
		for (int i = 1; i < Location.LexPos; i++)
			System.out.print(' ');
		System.out.println("^");
		System.out.println(
			"(Строка " + ELine + ") Ошибка: " + Msg
		);
		System.out.println();
		System.out.print("Нажмите ВВОД");
		try {
			while (System.in.read() != '\n') ;
		} catch (IOException e) {
		}
		;
		run.Close();
	}

	static void Expected(String Msg) {
		Message("Ожидается " + Msg);
	}

	static void printError(String msg) {
		System.out.println(msg);
		run.Close();
	}

	static void Warning(String Msg) {
		System.out.println();
		System.out.println("Предупреждение: " + Msg);
	}

}
